<%@ include file="connect.jsp" %>
<%--
  Created by IntelliJ IDEA.
  User: Mery
  Date: 10/25/12
  Time: 11:03 PM
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<link href="style.css" rel="stylesheet"/>

<html>
<head>
    <title></title>
    <script type="text/javascript">
        function validasi() {
            var nama = document.getElementById("gamesName").value;
            var sound = document.getElementById("sound").value;

            if (nama == null || nama == "") {
                err.innerHTML = "Please insert case's name!";
                return false;

            }
            else if (sound == null || sound == "") {
                err.innerHTML = "Please insert the sound's name!";
                return false;
            }
            else if (sound.indexOf(" ") >= 1) {
                err.innerHTML = "Sound's name can't contain spaces!";
                return false;
            }
            else {
                return true;
            }
        }

    </script>
</head>

<body>
<div id="popup-header">
    <h2>Update Case</h2>
</div>
<form action="doUpdateCase.jsp" method="post" onsubmit="return validasi()">
    <div class="txt-fld" id="word1">

        <label style="padding-top: 10px">Case Name</label>
        <label>:</label>
        <%
            String idnya = request.getParameter("id");

            ResultSet rs = stat.executeQuery("select * from Games where gamesID = '" + idnya + "' ");

            while (rs.next()) {

        %>
        <input style=" font-family: Segoe UI; font-size: 12pt"
               type="text" name="namaGames" id="namaGames" value="<% out.print(rs.getString("gamesName"));%>"/>
        </br>
        <label style="padding-top: 10px">Sound Name</label>
        <label style="padding-left: 4px">:</label>
        <input style=" font-family: Segoe UI; font-size: 12pt"
               type="text" name="sound" id="sound" value="<% out.print(rs.getString("sound"));%>"/>
        </br>
        <label style="color: red; font-weight: 800">*Please make sure the file is on the directory
       </label>

        <input type="hidden" name="id" id="id" value="<% out.print(rs.getString("gamesID"));%>">
        <input type="hidden" name="before" value="<% out.print(rs.getString("gamesName"));%>">
    </div>
    <%} %>
    <div id="err">

    </div>
    <div class="btn-fld" align="bottom">
        <button type="submit">Save</button>
    </div>

</form>


</body>
</html>